package org.bronycorps.mlptss.domain.ai.tweenable;

import org.bronycorps.mlptss.domain.ai.actor.VirtualIndestructibleActor;

import aurelienribon.tweenengine.TweenAccessor;

public class VirtualIndestructibleAccessor implements
		TweenAccessor<VirtualIndestructibleActor> {

	public static final int ALPHA = 5;
	public static final int POSITION_X = 3;
	public static final int POSITION_XY = 1;
	public static final int POSITION_Y = 2;
	public static final int SCALE = 4;

	@Override
	public int getValues(VirtualIndestructibleActor target, int tweenType,
			float[] returnValues) {
		switch (tweenType) {
		case POSITION_X:
			returnValues[0] = target.getPosition().x;
			return 1;
		case POSITION_Y:
			returnValues[0] = target.getPosition().y;
			return 1;
		case POSITION_XY:
			returnValues[0] = target.getPosition().x;
			returnValues[1] = target.getPosition().y;
			return 2;
		case SCALE:
			returnValues[0] = target.getScale();
			return 1;
		default:
			assert false;
			return -1;
		}
	}

	@Override
	public void setValues(VirtualIndestructibleActor target, int tweenType,
			float[] newValues) {
		switch (tweenType) {
		case POSITION_X:
			target.getPosition().x = (newValues[0]);
			break;
		case POSITION_Y:
			target.getPosition().y = (newValues[0]);
			break;
		case POSITION_XY:
			target.getPosition().set(newValues[0], newValues[1]);
			break;
		case SCALE:
			target.setScale(newValues[0]);
			break;
		default:
			assert false;
			break;
		}
	}

}
